﻿using System;
using System.IO;
using System.Collections.ObjectModel;

namespace VioletDevelopmentLaboratory.Net.Web.Component
{
	[Serializable]
	public class UploadFileInfo
	{
		private UploadFileInfo() { }

		public UploadFileInfo(String fileID, String originalFileName, String savedFullName, String contentType, String description)
		{
			this.fileID = fileID;
			this.originalFileName = originalFileName;
			this.savedFileName = Path.GetFileName(savedFullName);
			this.contentType = contentType;
			this.description = description;

			this.physicalFile = new FileInfo(savedFullName);

			this.contentLength = this.physicalFile.Exists ? this.physicalFile.Length : 0;
		}

		private String fileID;
		public String FileID { get { return this.fileID; } }

		private String originalFileName;
		public String OriginalFileName { get { return this.originalFileName; } }

		private String savedFileName;
		public String SavedFileName { get { return this.savedFileName; } }

		private String contentType;
		public String ContentType { get { return this.contentType; } }

		private Int64 contentLength;
		public Int64 ContentLength { get { return this.contentLength; } }

		private String description;
		public String Description { get { return this.description; } }

		private FileInfo physicalFile;
		public FileInfo PhysicalFile { get { return this.physicalFile; } }
	}

	[Serializable]
	public class UploadFileInfoCollection : Collection<UploadFileInfo> { }
}
